﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Gadgets.Common
{
    public partial class ContractType : UserControl
    {
        public ContractType()
        {
            InitializeComponent();
        }

        private void ContractType_Load(object sender, EventArgs e)
        {
            //cboContractType.Items.Clear();
            //cboContractType.ValueMember = "ID";
            //cboContractType.DisplayMember = "Value";
            //cboContractType.Items.Add(new MyComboItem("-1", string.Empty));
            //cboContractType.Items.Add(new MyComboItem("1", "HĐ Classic"));
            //cboContractType.Items.Add(new MyComboItem("2", "HĐ Silver"));
            //cboContractType.Items.Add(new MyComboItem("3", "HĐ Gold"));
            //cboContractType.Items.Add(new MyComboItem("4", "HĐ Diamond"));
            //cboContractType.Items.Add(new MyComboItem("9", "HĐ Titan"));
            //DataSet v_data = ABSCommonLibrary.GetDataSetFromProcedure("sp_sel_ContractType", "");
            //cboContractType.ValueMember = "ContractId";
            //cboContractType.DisplayMember = "FullName";
            //DataRow v_row = v_data.Tables[0].NewRow();
            //v_row["ContractId"] = -1;
            //v_row["FullName"] = string.Empty;
            //v_data.Tables[0].Rows.Add(v_row);
            //cboContractType.DataSource = v_data.Tables[0];            
            //cboContractType.SelectedIndex = cboContractType.Items.Count - 1;
        }
        public int Value
        {
            get
            {
                return Convert.ToInt16(((DataRowView)cboContractType.SelectedItem)["ContractId"]);
            }
        }
        public override string Text
        {
            get
            {
                return ((DataRowView)cboContractType.SelectedItem)["FullName"].ToString();
            }
        }
    }
}
